package com.dxd.onlineshop.mapper;

import com.dxd.onlineshop.pojo.Address;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface AddressMapper {
    List<Address> findByUserId(Long userId);

    Address findById(Long id);

    void insert(Address address);

    void update(Address address);

    void delete(Long id);

    int countByUserId(Long userId);

    Address findDefaultByUserId(Long userId);

    void updateDefaultStatus(@Param("userId") Long userId, @Param("addressId") Long addressId, @Param("isDefault") boolean isDefault);

    void resetDefaultForUser(Long userId);
}